

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>describe.descriptors.acsf &mdash; describe 0.1.0 documentation</title>
  

  
  
  
  

  

  
  
    

  

  <link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/style.css" type="text/css" />
    <link rel="author" title="About these documents" href="../../../about.html" />
    <link rel="index" title="Index" href="../../../genindex.html" />
    <link rel="search" title="Search" href="../../../search.html" /> 

  
  <script src="../../../_static/js/modernizr.min.js"></script>

</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">

    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search">
          

          
            <a href="../../../index.html" class="icon icon-home"> describe
          

          
          </a>

          
            
            
              <div class="version">
                0.1.0
              </div>
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul>
<li class="toctree-l1"><a class="reference internal" href="../../../install.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../tutorials/tutorials.html">Tutorials</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../doc/modules.html">Documentation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../about.html">About</a></li>
</ul>

            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../../index.html">describe</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../../index.html">Docs</a> &raquo;</li>
        
          <li><a href="../../index.html">Module code</a> &raquo;</li>
        
      <li>describe.descriptors.acsf</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <h1>Source code for describe.descriptors.acsf</h1><div class="highlight"><pre>
<span></span><span class="kn">from</span> <span class="nn">__future__</span> <span class="k">import</span> <span class="n">absolute_import</span><span class="p">,</span> <span class="n">division</span><span class="p">,</span> <span class="n">print_function</span><span class="p">,</span> <span class="n">unicode_literals</span>
<span class="kn">from</span> <span class="nn">builtins</span> <span class="k">import</span> <span class="p">(</span><span class="nb">bytes</span><span class="p">,</span> <span class="nb">str</span><span class="p">,</span> <span class="nb">open</span><span class="p">,</span> <span class="nb">super</span><span class="p">,</span> <span class="nb">range</span><span class="p">,</span> <span class="nb">zip</span><span class="p">,</span> <span class="nb">round</span><span class="p">,</span> <span class="nb">input</span><span class="p">,</span> <span class="nb">int</span><span class="p">,</span> <span class="nb">pow</span><span class="p">,</span> <span class="nb">object</span><span class="p">)</span>
<span class="kn">import</span> <span class="nn">os</span><span class="o">,</span> <span class="nn">glob</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="kn">from</span> <span class="nn">ctypes</span> <span class="k">import</span> <span class="n">cdll</span><span class="p">,</span> <span class="n">Structure</span><span class="p">,</span> <span class="n">c_int</span><span class="p">,</span> <span class="n">c_double</span><span class="p">,</span> <span class="n">POINTER</span><span class="p">,</span> <span class="n">byref</span>

<span class="kn">from</span> <span class="nn">describe.descriptors.descriptor</span> <span class="k">import</span> <span class="n">Descriptor</span>


<span class="n">_PATH_TO_ACSF_SO</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="vm">__file__</span><span class="p">))</span>
<span class="n">_ACSF_SOFILES</span> <span class="o">=</span> <span class="n">glob</span><span class="o">.</span><span class="n">glob</span><span class="p">(</span> <span class="s2">&quot;&quot;</span><span class="o">.</span><span class="n">join</span><span class="p">([</span> <span class="n">_PATH_TO_ACSF_SO</span><span class="p">,</span> <span class="s2">&quot;/../libacsf/libacsf.*so*&quot;</span><span class="p">]))</span>
<span class="n">_LIBACSF</span> <span class="o">=</span> <span class="n">cdll</span><span class="o">.</span><span class="n">LoadLibrary</span><span class="p">(</span><span class="n">_ACSF_SOFILES</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>


<div class="viewcode-block" id="ACSFObject"><a class="viewcode-back" href="../../../doc/describe.descriptors.html#describe.descriptors.acsf.ACSFObject">[docs]</a><span class="k">class</span> <span class="nc">ACSFObject</span><span class="p">(</span><span class="n">Structure</span><span class="p">):</span>
    <span class="n">_fields_</span> <span class="o">=</span> <span class="p">[</span>
        <span class="p">(</span><span class="s1">&#39;natm&#39;</span><span class="p">,</span> <span class="n">c_int</span><span class="p">),</span>
        <span class="p">(</span><span class="s1">&#39;Z&#39;</span><span class="p">,</span> <span class="n">POINTER</span><span class="p">(</span><span class="n">c_int</span><span class="p">)),</span>
        <span class="p">(</span><span class="s1">&#39;positions&#39;</span><span class="p">,</span> <span class="n">POINTER</span><span class="p">(</span><span class="n">c_double</span><span class="p">)),</span>
        <span class="p">(</span><span class="s1">&#39;nTypes&#39;</span><span class="p">,</span> <span class="n">c_int</span><span class="p">),</span>
        <span class="p">(</span><span class="s1">&#39;types&#39;</span><span class="p">,</span> <span class="n">POINTER</span><span class="p">(</span><span class="n">c_int</span><span class="p">)),</span>
        <span class="p">(</span><span class="s1">&#39;typeID&#39;</span><span class="p">,</span> <span class="p">(</span><span class="n">c_int</span><span class="o">*</span><span class="mi">100</span><span class="p">)),</span>
        <span class="p">(</span><span class="s1">&#39;nSymTypes&#39;</span><span class="p">,</span> <span class="n">c_int</span><span class="p">),</span>
        <span class="p">(</span><span class="s1">&#39;cutoff&#39;</span><span class="p">,</span> <span class="n">c_double</span><span class="p">),</span>

        <span class="p">(</span><span class="s1">&#39;n_bond_params&#39;</span><span class="p">,</span> <span class="n">c_int</span><span class="p">),</span>
        <span class="p">(</span><span class="s1">&#39;bond_params&#39;</span><span class="p">,</span> <span class="n">POINTER</span><span class="p">(</span><span class="n">c_double</span><span class="p">)),</span>

        <span class="p">(</span><span class="s1">&#39;n_bond_cos_params&#39;</span><span class="p">,</span> <span class="n">c_int</span><span class="p">),</span>
        <span class="p">(</span><span class="s1">&#39;bond_cos_params&#39;</span><span class="p">,</span> <span class="n">POINTER</span><span class="p">(</span><span class="n">c_double</span><span class="p">)),</span>

        <span class="p">(</span><span class="s1">&#39;n_ang_params&#39;</span><span class="p">,</span> <span class="n">c_int</span><span class="p">),</span>
        <span class="p">(</span><span class="s1">&#39;ang_params&#39;</span><span class="p">,</span> <span class="n">POINTER</span><span class="p">(</span><span class="n">c_double</span><span class="p">)),</span>


        <span class="p">(</span><span class="s1">&#39;distances&#39;</span><span class="p">,</span> <span class="n">POINTER</span><span class="p">(</span><span class="n">c_double</span><span class="p">)),</span>
        <span class="p">(</span><span class="s1">&#39;nG2&#39;</span><span class="p">,</span> <span class="n">c_int</span><span class="p">),</span>
        <span class="p">(</span><span class="s1">&#39;nG3&#39;</span><span class="p">,</span> <span class="n">c_int</span><span class="p">),</span>
        <span class="p">(</span><span class="s1">&#39;G2&#39;</span><span class="p">,</span> <span class="n">POINTER</span><span class="p">(</span><span class="n">c_double</span><span class="p">)),</span>
        <span class="p">(</span><span class="s1">&#39;G3&#39;</span><span class="p">,</span> <span class="n">POINTER</span><span class="p">(</span><span class="n">c_double</span><span class="p">)),</span>

        <span class="p">(</span><span class="s1">&#39;acsfs&#39;</span><span class="p">,</span> <span class="n">POINTER</span><span class="p">(</span><span class="n">c_double</span><span class="p">)),</span>

        <span class="p">(</span><span class="s1">&#39;alloc_atoms&#39;</span><span class="p">,</span> <span class="n">c_int</span><span class="p">),</span>
        <span class="p">(</span><span class="s1">&#39;alloc_work&#39;</span><span class="p">,</span> <span class="n">c_int</span><span class="p">)</span>
    <span class="p">]</span></div>

<span class="c1"># libacsf.acsf_init.argtypes = [POINTER(ACSFObject)]</span>
<span class="c1"># libacsf.acsf_reset.argtypes = [POINTER(ACSFObject)]</span>
<span class="n">_LIBACSF</span><span class="o">.</span><span class="n">acsf_compute_acsfs</span><span class="o">.</span><span class="n">argtypes</span> <span class="o">=</span> <span class="p">[</span><span class="n">POINTER</span><span class="p">(</span><span class="n">ACSFObject</span><span class="p">)]</span>


<div class="viewcode-block" id="ACSF"><a class="viewcode-back" href="../../../doc/describe.descriptors.html#describe.descriptors.acsf.ACSF">[docs]</a><span class="k">class</span> <span class="nc">ACSF</span><span class="p">(</span><span class="n">Descriptor</span><span class="p">):</span>

    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">n_atoms_max</span><span class="p">,</span> <span class="n">types</span><span class="p">,</span> <span class="n">bond_params</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">bond_cos_params</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">ang_params</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">flatten</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;</span>
<span class="sd">        Args:</span>
<span class="sd">        flatten (bool): Whether the output of create() should be flattened</span>
<span class="sd">        to a 1D array.</span>
<span class="sd">        &quot;&quot;&quot;</span>
        <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">flatten</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_inited</span> <span class="o">=</span> <span class="kc">False</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span> <span class="o">=</span> <span class="n">ACSFObject</span><span class="p">()</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">alloc_atoms</span> <span class="o">=</span> <span class="mi">0</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">alloc_work</span> <span class="o">=</span> <span class="mi">0</span>

        <span class="c1">#print(self._obj.alloc_work)</span>

        <span class="sd">&#39;&#39;&#39;// number of 2- and 3-body ACSFs per atom!</span>
<span class="sd">        //qm-&gt;nG2 = 1 + NBONDETA*NBONDRS + NBONDCOS;</span>
<span class="sd">        //qm-&gt;nG3 = 2*NBONDETA*NANGZETA;</span>
<span class="sd">        //qm-&gt;nG3 = 4*NBONDETA*NANGZETA; // for the Gang45 version</span>
<span class="sd">        &#39;&#39;&#39;</span>
        <span class="k">if</span> <span class="n">n_atoms_max</span> <span class="o">&lt;=</span> <span class="mi">0</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;Maximum number of atoms n_atoms_max should be positive.&quot;</span><span class="p">)</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">_n_atoms_max</span> <span class="o">=</span> <span class="n">n_atoms_max</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">_types</span> <span class="o">=</span> <span class="kc">None</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">types</span> <span class="o">=</span> <span class="n">types</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">_Zs</span> <span class="o">=</span> <span class="kc">None</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">_bond_params</span> <span class="o">=</span> <span class="kc">None</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">bond_params</span> <span class="o">=</span> <span class="n">bond_params</span>  <span class="c1"># np.array([[5.0, 0.0],[1.0, 0.0],[0.5, 0.0],[0.1, 0.0]])</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">_bond_cos_params</span> <span class="o">=</span> <span class="kc">None</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">bond_cos_params</span> <span class="o">=</span> <span class="n">bond_cos_params</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">_ang_params</span> <span class="o">=</span> <span class="kc">None</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">ang_params</span> <span class="o">=</span> <span class="n">ang_params</span>  <span class="c1"># np.array([[0.1, 1, 1],[0.1, 1, -1],[0.1, 2, 1],[0.1, 2, -1]])</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">_rcut</span> <span class="o">=</span> <span class="kc">None</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">rcut</span> <span class="o">=</span> <span class="mf">5.0</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">positions</span> <span class="o">=</span> <span class="kc">None</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">distances</span> <span class="o">=</span> <span class="kc">None</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">_acsfBuffer</span> <span class="o">=</span> <span class="kc">None</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">acsf_bond</span> <span class="o">=</span> <span class="kc">None</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">acsf_ang</span> <span class="o">=</span> <span class="kc">None</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">_inited</span> <span class="o">=</span> <span class="kc">True</span>

    <span class="c1"># --- TYPES ---</span>
    <span class="nd">@property</span>
    <span class="k">def</span> <span class="nf">types</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
            <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_types</span>

    <span class="nd">@types</span><span class="o">.</span><span class="n">setter</span>
    <span class="k">def</span> <span class="nf">types</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_inited</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;Cannot change the atomic types.&quot;</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">value</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;Atomic types cannot be None.&quot;</span><span class="p">)</span>

        <span class="n">pmatrix</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">int32</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">pmatrix</span><span class="o">.</span><span class="n">ndim</span> <span class="o">!=</span> <span class="mi">1</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;Atomic types should be a vector of integers.&quot;</span><span class="p">)</span>

        <span class="n">pmatrix</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">unique</span><span class="p">(</span><span class="n">pmatrix</span><span class="p">)</span>
        <span class="n">pmatrix</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">sort</span><span class="p">(</span><span class="n">pmatrix</span><span class="p">)</span>

        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Setting types to: &quot;</span><span class="o">+</span><span class="nb">str</span><span class="p">(</span><span class="n">pmatrix</span><span class="p">))</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">_types</span> <span class="o">=</span> <span class="n">pmatrix</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">types</span> <span class="o">=</span> <span class="n">pmatrix</span><span class="o">.</span><span class="n">ctypes</span><span class="o">.</span><span class="n">data_as</span><span class="p">(</span><span class="n">POINTER</span><span class="p">(</span><span class="n">c_int</span><span class="p">))</span>

        <span class="c1"># set the internal indexer</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">nTypes</span> <span class="o">=</span> <span class="n">c_int</span><span class="p">(</span><span class="n">pmatrix</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">nSymTypes</span> <span class="o">=</span> <span class="n">c_int</span><span class="p">(</span><span class="nb">int</span><span class="p">((</span><span class="n">pmatrix</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">*</span><span class="p">(</span><span class="n">pmatrix</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">+</span><span class="mi">1</span><span class="p">))</span><span class="o">/</span><span class="mi">2</span><span class="p">))</span>

        <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">pmatrix</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">]):</span>
                <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">typeID</span><span class="p">[</span> <span class="bp">self</span><span class="o">.</span><span class="n">_types</span><span class="p">[</span><span class="n">i</span><span class="p">]]</span> <span class="o">=</span> <span class="n">i</span>
    <span class="c1"># --- ----- ---</span>

    <span class="c1"># --- CUTOFF RADIUS ---</span>
    <span class="nd">@property</span>
    <span class="k">def</span> <span class="nf">rcut</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_rcut</span>

    <span class="nd">@rcut</span><span class="o">.</span><span class="n">setter</span>
    <span class="k">def</span> <span class="nf">rcut</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">_rcut</span> <span class="o">=</span> <span class="n">c_double</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">cutoff</span> <span class="o">=</span> <span class="n">c_double</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
    <span class="c1"># --- ------------- ---</span>

    <span class="c1"># --- BOND PARAMETERS ---</span>
    <span class="nd">@property</span>
    <span class="k">def</span> <span class="nf">bond_params</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
            <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_bond_params</span>

    <span class="nd">@bond_params</span><span class="o">.</span><span class="n">setter</span>
    <span class="k">def</span> <span class="nf">bond_params</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>

        <span class="c1"># TODO: check that the user input makes sense...</span>
        <span class="c1"># ...</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_inited</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;Cannot change 2-body ACSF parameters.&quot;</span><span class="p">)</span>

        <span class="c1"># handle the disable case</span>
        <span class="k">if</span> <span class="n">value</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="c1"># print(&quot;Disabling 2-body ACSFs...&quot;)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">n_bond_params</span> <span class="o">=</span> <span class="mi">0</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_bond_params</span> <span class="o">=</span> <span class="kc">None</span>
            <span class="k">return</span>

        <span class="n">pmatrix</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">double</span><span class="p">)</span>  <span class="c1"># convert to array just to be safe!</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Setting 2-body ACSFs...&quot;</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">pmatrix</span><span class="o">.</span><span class="n">ndim</span> <span class="o">!=</span> <span class="mi">2</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;arghhh! bond_params should be a matrix with two columns (eta, Rs).&quot;</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">pmatrix</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">!=</span> <span class="mi">2</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;arghhh! bond_params should be a matrix with two columns (eta, Rs).&quot;</span><span class="p">)</span>

        <span class="c1"># store what the user gave in the private variable</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_bond_params</span> <span class="o">=</span> <span class="n">pmatrix</span>

        <span class="c1"># get the number of parameter pairs</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">n_bond_params</span> <span class="o">=</span> <span class="n">c_int</span><span class="p">(</span><span class="n">pmatrix</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>

        <span class="c1"># convert the input list to ctypes</span>
        <span class="c1">#self._obj.bond_params = c_double(pmatrix.shape[0] * pmatrix.shape[1])</span>

        <span class="c1">#assign it</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">bond_params</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_bond_params</span><span class="o">.</span><span class="n">ctypes</span><span class="o">.</span><span class="n">data_as</span><span class="p">(</span><span class="n">POINTER</span><span class="p">(</span><span class="n">c_double</span><span class="p">))</span>
    <span class="c1"># --- --------------- ---</span>

    <span class="c1"># --- COS PARAMS ---</span>
    <span class="nd">@property</span>
    <span class="k">def</span> <span class="nf">bond_cos_params</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_bond_cos_params</span>

    <span class="nd">@bond_cos_params</span><span class="o">.</span><span class="n">setter</span>
    <span class="k">def</span> <span class="nf">bond_cos_params</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>

        <span class="c1"># TODO: check that the user input makes sense...</span>
        <span class="c1"># ...</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_inited</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;Cannot change 2-body Cos-type ACSF parameters.&quot;</span><span class="p">)</span>

        <span class="c1"># handle the disable case</span>
        <span class="k">if</span> <span class="n">value</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Disabling 2-body COS-type ACSFs...&quot;</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">n_bond_cos_params</span> <span class="o">=</span> <span class="mi">0</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_bond_cos_params</span> <span class="o">=</span> <span class="kc">None</span>
            <span class="k">return</span>

        <span class="n">pmatrix</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">double</span><span class="p">)</span>  <span class="c1"># convert to array just to be safe!</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Setting 2-body COS-type ACSFs...&quot;</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">pmatrix</span><span class="o">.</span><span class="n">ndim</span> <span class="o">!=</span> <span class="mi">1</span><span class="p">:</span>
                <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;arghhh! bond_cos_params should be a vector.&quot;</span><span class="p">)</span>

        <span class="c1"># store what the user gave in the private variable</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_bond_cos_params</span> <span class="o">=</span> <span class="n">pmatrix</span>

        <span class="c1"># get the number of parameter pairs</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">n_bond_cos_params</span> <span class="o">=</span> <span class="n">c_int</span><span class="p">(</span><span class="n">pmatrix</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>

        <span class="c1">#assign it</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">bond_cos_params</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_bond_cos_params</span><span class="o">.</span><span class="n">ctypes</span><span class="o">.</span><span class="n">data_as</span><span class="p">(</span><span class="n">POINTER</span><span class="p">(</span><span class="n">c_double</span><span class="p">))</span>
        <span class="c1"># --- ---------- ---</span>

    <span class="c1"># --- ANG PARAMS ---</span>
    <span class="nd">@property</span>
    <span class="k">def</span> <span class="nf">ang_params</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
            <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ang_params</span>

    <span class="nd">@ang_params</span><span class="o">.</span><span class="n">setter</span>
    <span class="k">def</span> <span class="nf">ang_params</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>

        <span class="c1"># TODO: check that the user input makes sense...</span>
        <span class="c1"># ...</span>
        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_inited</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;Cannot change 3-body ACSF parameters.&quot;</span><span class="p">)</span>

        <span class="c1"># handle the disable case</span>
        <span class="k">if</span> <span class="n">value</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Disabling 3-body ACSFs...&quot;</span><span class="p">)</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">n_ang_params</span> <span class="o">=</span> <span class="mi">0</span>
            <span class="bp">self</span><span class="o">.</span><span class="n">_ang_params</span> <span class="o">=</span> <span class="kc">None</span>
            <span class="k">return</span>

        <span class="n">pmatrix</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">double</span><span class="p">)</span>  <span class="c1"># convert to array just to be safe!</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Setting 3-body ACSFs...&quot;</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">pmatrix</span><span class="o">.</span><span class="n">ndim</span> <span class="o">!=</span> <span class="mi">2</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;arghhh! ang_params should be a matrix with three columns (eta, zeta, lambda).&quot;</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">pmatrix</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">!=</span> <span class="mi">3</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;arghhh! ang_params should be a matrix with three columns (eta, zeta, lambda).&quot;</span><span class="p">)</span>

        <span class="c1"># store what the user gave in the private variable</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_ang_params</span> <span class="o">=</span> <span class="n">pmatrix</span>

        <span class="c1"># get the number of parameter pairs</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">n_ang_params</span> <span class="o">=</span> <span class="n">c_int</span><span class="p">(</span><span class="n">pmatrix</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>

        <span class="c1">#assign it</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">ang_params</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ang_params</span><span class="o">.</span><span class="n">ctypes</span><span class="o">.</span><span class="n">data_as</span><span class="p">(</span><span class="n">POINTER</span><span class="p">(</span><span class="n">c_double</span><span class="p">))</span>
    <span class="c1"># --- ---------- ---</span>

<div class="viewcode-block" id="ACSF.Compute"><a class="viewcode-back" href="../../../doc/describe.descriptors.html#describe.descriptors.acsf.ACSF.Compute">[docs]</a>    <span class="k">def</span> <span class="nf">Compute</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>

        <span class="n">lib</span><span class="o">.</span><span class="n">acsf_reset</span><span class="p">(</span><span class="n">byref</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="p">))</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">nG2</span> <span class="o">=</span> <span class="n">c_int</span><span class="p">(</span><span class="mi">1</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">neta</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">nrs</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">ncos</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">nG3</span> <span class="o">=</span> <span class="n">c_int</span><span class="p">(</span><span class="mi">2</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">neta</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">nzeta</span><span class="p">)</span>

        <span class="n">lib</span><span class="o">.</span><span class="n">acsf_init</span><span class="p">(</span><span class="n">byref</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">obj</span><span class="p">))</span>
        <span class="n">lib</span><span class="o">.</span><span class="n">acsf_compute_acsfs</span><span class="p">(</span><span class="n">byref</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">obj</span><span class="p">))</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">acsf_bond</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">ctypeslib</span><span class="o">.</span><span class="n">as_array</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">obj</span><span class="o">.</span><span class="n">G2</span><span class="p">,</span>
        <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">obj</span><span class="o">.</span><span class="n">natm</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">obj</span><span class="o">.</span><span class="n">nTypes</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">obj</span><span class="o">.</span><span class="n">nG2</span><span class="p">))</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">acsf_ang</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">ctypeslib</span><span class="o">.</span><span class="n">as_array</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">obj</span><span class="o">.</span><span class="n">G3</span><span class="p">,</span>
        <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">obj</span><span class="o">.</span><span class="n">natm</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">obj</span><span class="o">.</span><span class="n">nSymTypes</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">obj</span><span class="o">.</span><span class="n">nG3</span><span class="p">))</span></div>

<div class="viewcode-block" id="ACSF.describe"><a class="viewcode-back" href="../../../doc/describe.descriptors.html#describe.descriptors.acsf.ACSF.describe">[docs]</a>    <span class="k">def</span> <span class="nf">describe</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">system</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Creates the descriptor for the given systems.</span>

<span class="sd">        Args:</span>
<span class="sd">        system (System): The system for which to create the</span>
<span class="sd">        descriptor.</span>

<span class="sd">        Returns:</span>
<span class="sd">        A descriptor for the system in some numerical form.</span>
<span class="sd">        &quot;&quot;&quot;</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_types</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
            <span class="c1"># GIVE AN ERROR</span>
            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;No atomic types declared for the descriptor.&quot;</span><span class="p">)</span>

        <span class="c1"># copy the atomic numbers</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_Zs</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">system</span><span class="o">.</span><span class="n">get_atomic_numbers</span><span class="p">(),</span> <span class="n">dtype</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">int32</span><span class="p">)</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_Zs</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">_n_atoms_max</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;The system has more atoms than n_atoms_max.&quot;</span><span class="p">)</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">Z</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_Zs</span><span class="o">.</span><span class="n">ctypes</span><span class="o">.</span><span class="n">data_as</span><span class="p">(</span><span class="n">POINTER</span><span class="p">(</span><span class="n">c_int</span><span class="p">))</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">natm</span> <span class="o">=</span> <span class="n">c_int</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_Zs</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>

        <span class="c1"># check the types in the system</span>
        <span class="n">typs</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">system</span><span class="o">.</span><span class="n">get_atomic_numbers</span><span class="p">())</span>
        <span class="n">typs</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">unique</span><span class="p">(</span><span class="n">typs</span><span class="p">)</span>
        <span class="n">typs</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">sort</span><span class="p">(</span><span class="n">typs</span><span class="p">)</span>

        <span class="c1"># check if there are types not declared in self.types</span>
        <span class="n">isin</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">in1d</span><span class="p">(</span><span class="n">typs</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_types</span><span class="p">)</span>
        <span class="n">isin</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">unique</span><span class="p">(</span><span class="n">isin</span><span class="p">)</span>

        <span class="k">if</span> <span class="n">isin</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">&gt;</span> <span class="mi">1</span> <span class="ow">or</span> <span class="n">isin</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="ow">is</span> <span class="kc">False</span><span class="p">:</span>
            <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;The system has types that were not declared.&quot;</span><span class="p">)</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">positions</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">system</span><span class="o">.</span><span class="n">get_positions</span><span class="p">(),</span> <span class="n">dtype</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">double</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">positions</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">positions</span><span class="o">.</span><span class="n">ctypes</span><span class="o">.</span><span class="n">data_as</span><span class="p">(</span><span class="n">POINTER</span><span class="p">(</span><span class="n">c_double</span><span class="p">))</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">distances</span> <span class="o">=</span> <span class="n">system</span><span class="o">.</span><span class="n">get_distance_matrix</span><span class="p">()</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">distances</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">distances</span><span class="o">.</span><span class="n">ctypes</span><span class="o">.</span><span class="n">data_as</span><span class="p">(</span><span class="n">POINTER</span><span class="p">(</span><span class="n">c_double</span><span class="p">))</span>

        <span class="c1"># amount of ACSFs for one atom for each type pair or triplet</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">nG2</span> <span class="o">=</span> <span class="n">c_int</span><span class="p">(</span><span class="mi">1</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">n_bond_params</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">n_bond_cos_params</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">nG3</span> <span class="o">=</span> <span class="n">c_int</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">n_ang_params</span><span class="p">)</span>

        <span class="bp">self</span><span class="o">.</span><span class="n">_acsfBuffer</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">zeros</span><span class="p">((</span><span class="bp">self</span><span class="o">.</span><span class="n">_n_atoms_max</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">nG2</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">nTypes</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">nG3</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">nSymTypes</span><span class="p">))</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">acsfs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_acsfBuffer</span><span class="o">.</span><span class="n">ctypes</span><span class="o">.</span><span class="n">data_as</span><span class="p">(</span><span class="n">POINTER</span><span class="p">(</span><span class="n">c_double</span><span class="p">))</span>

        <span class="n">_LIBACSF</span><span class="o">.</span><span class="n">acsf_compute_acsfs</span><span class="p">(</span><span class="n">byref</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="p">))</span>

        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">flatten</span> <span class="ow">is</span> <span class="kc">True</span><span class="p">:</span>
            <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_acsfBuffer</span><span class="o">.</span><span class="n">flatten</span><span class="p">()</span>

        <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_acsfBuffer</span></div>

<div class="viewcode-block" id="ACSF.get_number_of_features"><a class="viewcode-back" href="../../../doc/describe.descriptors.html#describe.descriptors.acsf.ACSF.get_number_of_features">[docs]</a>    <span class="k">def</span> <span class="nf">get_number_of_features</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="sd">&quot;&quot;&quot;Used to inquire the final number of features that this descriptor</span>
<span class="sd">        will have.</span>

<span class="sd">        Returns:</span>
<span class="sd">        int: Number of features for this descriptor.</span>
<span class="sd">        &quot;&quot;&quot;</span>

        <span class="n">descsize</span> <span class="o">=</span> <span class="p">(</span><span class="mi">1</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">n_bond_params</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">n_bond_cos_params</span><span class="p">)</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">nTypes</span>
        <span class="n">descsize</span> <span class="o">+=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">n_ang_params</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">_obj</span><span class="o">.</span><span class="n">nSymTypes</span>

        <span class="n">descsize</span> <span class="o">*=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_n_atoms_max</span>

        <span class="k">return</span> <span class="n">descsize</span></div></div>
</pre></div>

           </div>
           
          </div>
          <footer>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright .

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  

    <script type="text/javascript">
        var DOCUMENTATION_OPTIONS = {
            URL_ROOT:'../../../',
            VERSION:'0.1.0',
            LANGUAGE:'None',
            COLLAPSE_INDEX:false,
            FILE_SUFFIX:'.html',
            HAS_SOURCE:  true,
            SOURCELINK_SUFFIX: '.txt'
        };
    </script>
      <script type="text/javascript" src="../../../_static/jquery.js"></script>
      <script type="text/javascript" src="../../../_static/underscore.js"></script>
      <script type="text/javascript" src="../../../_static/doctools.js"></script>
      <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>

  

  <script type="text/javascript" src="../../../_static/js/theme.js"></script>

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script> 

</body>
</html>